<?php

namespace common\models;

use Yii;

/**
 * This is the model class for table "{{%zancai_comment}}".
 *
 * @property string $ip_address
 * @property integer $comment_id
 * @property integer $type
 *
 * @property Comment $comment
 */
class ZancaiComment extends \yii\db\ActiveRecord
{
    /**
     * @inheritdoc
     */
    public static function tableName()
    {
        return '{{%zancai_comment}}';
    }

    /**
     * @inheritdoc
     */
    public function rules()
    {
        return [
            [['ip_address', 'comment_id'], 'required'],
            [['comment_id'], 'integer'],
            [['ip_address'], 'string', 'max' => 255]
        ];
    }

    /**
     * @inheritdoc
     */
    public function attributeLabels()
    {
        return [
            'ip_address' => 'Ip Address',
            'comment_id' => 'Comment ID',
        ];
    }

    /**
     * @return \yii\db\ActiveQuery
     */
    public function getComment()
    {
        return $this->hasOne(Comment::className(), ['id' => 'comment_id']);
    }
}
